package cate.game.play.skill.passive.fairy;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;
import cate.game.play.skill.effect.SkillEffect;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 口诛笔伐"额外攻击1个随机目标，额外目标附加【禁疗】的概率为50%
 */
public class 米兰意面灵器PH extends PassiveHandler {

	private String 技能标签;

	private int 人数;

	private int 概率;


	//技能标签=口诛笔伐&人数=1&概率=-5000
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		技能标签 = args.get("技能标签");
		人数 = args.getInt("人数",0);
		概率 = args.getInt("概率", 0);
	}

	@Override
	public void beforeOwnerMove(MoveCtx move, TimeActionCtx action) {
		if(!move.getSkill().cfg.containTag(技能标签)){
			return;
		}
		move.getSkill().param.addTargetNum(人数);
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (!action.getSkill().cfg.containTag(技能标签)) {
			return;
		}
		for (Fighter target : action.getExTargets()) {
			effect.getTargetCtx(target.getPid()).addBuffChance(概率);
		}
	}
}
